/* 响应式适配样式 */

/* 基础响应式容器 */
.responsive-container {
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
}

/* 移动端优化 */
@media (max-width: 767px) {
  .responsive-container {
    /* 移动端滚动优化 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* 移动端字体优化 */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  
  /* 移动端触摸优化 */
  button, 
  [role="button"],
  input,
  select,
  textarea {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* 移动端最小触摸目标 */
  button,
  [role="button"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 移动端输入框优化 */
  input,
  textarea {
    font-size: 16px; /* 防止 iOS 缩放 */
  }
}

/* 平板端优化 */
@media (min-width: 768px) and (max-width: 1023px) {
  .responsive-container {
    max-width: 768px;
  }
}

/* 桌面端优化 */
@media (min-width: 1024px) {
  .responsive-container {
    max-width: 1200px;
  }
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
  .safe-area-top {
    padding-top: max(env(safe-area-inset-top), 20px);
  }
  
  .safe-area-bottom {
    padding-bottom: max(env(safe-area-inset-bottom), 20px);
  }
  
  .safe-area-left {
    padding-left: max(env(safe-area-inset-left), 20px);
  }
  
  .safe-area-right {
    padding-right: max(env(safe-area-inset-right), 20px);
  }
}

/* 响应式网格系统 */
.responsive-grid {
  display: grid;
  gap: 1rem;
}

@media (max-width: 767px) {
  .responsive-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .responsive-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .responsive-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

/* 响应式文本 */
.responsive-text {
  line-height: 1.5;
}

@media (max-width: 767px) {
  .responsive-text {
    font-size: 14px;
    line-height: 1.4;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .responsive-text {
    font-size: 16px;
    line-height: 1.5;
  }
}

@media (min-width: 1024px) {
  .responsive-text {
    font-size: 18px;
    line-height: 1.6;
  }
}

/* 响应式间距 */
.responsive-spacing {
  margin: 1rem 0;
}

@media (max-width: 767px) {
  .responsive-spacing {
    margin: 0.75rem 0;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .responsive-spacing {
    margin: 1rem 0;
  }
}

@media (min-width: 1024px) {
  .responsive-spacing {
    margin: 1.5rem 0;
  }
}

/* 响应式隐藏/显示 */
.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: block;
  }
  
  .show-mobile {
    display: none;
  }
}

/* 响应式图片 */
.responsive-image {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 响应式表格 */
.responsive-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
  .responsive-table table {
    min-width: 600px;
  }
}

/* 响应式导航 */
.responsive-nav {
  position: relative;
}

@media (max-width: 767px) {
  .responsive-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
  }
}

/* 响应式模态框 */
.responsive-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

@media (max-width: 767px) {
  .responsive-modal {
    align-items: flex-end;
  }
  
  .responsive-modal-content {
    width: 100%;
    max-height: 90vh;
    border-radius: 12px 12px 0 0;
  }
}

/* 响应式卡片 */
.responsive-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

@media (max-width: 767px) {
  .responsive-card {
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid #e5e7eb;
  }
}

/* 响应式按钮组 */
.responsive-button-group {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 767px) {
  .responsive-button-group {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .responsive-button-group button {
    width: 100%;
  }
}

/* 响应式表单 */
.responsive-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .responsive-form {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
  }
  
  .responsive-form .form-group {
    flex: 1;
    min-width: 200px;
  }
}

/* 响应式侧边栏 */
.responsive-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: white;
  border-right: 1px solid #e5e7eb;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.responsive-sidebar.open {
  transform: translateX(0);
}

@media (min-width: 1024px) {
  .responsive-sidebar {
    position: static;
    transform: none;
    width: auto;
  }
}

/* 响应式主内容区 */
.responsive-main {
  flex: 1;
  min-width: 0;
}

@media (max-width: 1023px) {
  .responsive-main {
    margin-left: 0;
  }
}

/* 响应式工具提示 */
.responsive-tooltip {
  position: absolute;
  background: #1f2937;
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
}

@media (max-width: 767px) {
  .responsive-tooltip {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;
    max-width: 80vw;
  }
}

/* 响应式加载状态 */
.responsive-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

@media (max-width: 767px) {
  .responsive-loading {
    min-height: 150px;
  }
}

/* 响应式错误状态 */
.responsive-error {
  text-align: center;
  padding: 2rem;
  color: #ef4444;
}

@media (max-width: 767px) {
  .responsive-error {
    padding: 1rem;
  }
}

/* 响应式空状态 */
.responsive-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

@media (max-width: 767px) {
  .responsive-empty {
    padding: 2rem 1rem;
  }
}

/* 响应式动画 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 响应式打印样式 */
@media print {
  .responsive-container {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  
  .hide-print {
    display: none !important;
  }
} 